package com.game.btnClass
{
	import fl.motion.ColorMatrix;
	
	import flash.display.DisplayObject;
	import flash.events.MouseEvent;
	import flash.filters.ColorMatrixFilter;
	
	public class BtnClass_bright extends AddMouseEvent
	{
		public function BtnClass_bright(sp:*, click:Function=null, mouseOut:Function=null, mouseOver:Function=null, isTarget:Boolean=false)
		{
			sp.buttonMode=true;
			super(sp, click, mouseOut, mouseOver, isTarget);
			
			
		}
		override protected function mouseOut(event:MouseEvent) : void
		{
			_sp.filters=[];;
			if (this._mouseOut != null)
			{
				if(_isTartget){
					this._mouseOut(event);
				}else{
					this._mouseOut();
				}
			}
		}
		
		override protected function mouseOver(event:MouseEvent) : void
		{
			_sp.filters=[getBrightFilter()];
			if (this._mouseOver != null)
			{
				if(_isTartget){
					this._mouseOver(event);
				}else{
					this._mouseOver();
				}
			}
		}
		private function getBrightFilter():ColorMatrixFilter{
			var ld_Matrix:ColorMatrix=new ColorMatrix();  
			var ld_Filter:ColorMatrixFilter=new ColorMatrixFilter();  
			ld_Matrix.SetBrightnessMatrix(40);    
			//设置亮度值，值的大小是 -255--255  0为中间值，向右为亮向左为暗。  
			ld_Filter.matrix = ld_Matrix.GetFlatArray();  
			return ld_Filter;  
		}
	}
}